package org.kaindorf.kainflix.metadata.service;

import java.util.Collection;
import org.kaindorf.kainflix.metadata.exceptions.DataNotFoundException;
import org.kaindorf.kainflix.metadata.exceptions.IllegalDataGiven;
import org.kaindorf.kainflix.metadata.repository.entity.MetaData;

public interface MetaDataService {
    
    /**
     * Saves the new meta data.
     * @param metaData
     * @return the MetaData bound to the persistence context
     * @throws IllegalDataGiven when the entity is not valid
     */
    public MetaData saveMetaData(MetaData metaData);
    
    /**
     * Updates the meta data by replacing it with the given one.
     * @param metaData
     * @return the MetaData bound to the persistence context
     * @throws DataNotFoundException when the specified meta data could not be found
     */
    public MetaData updateMetaData(MetaData metaData);
    
    /**
     * Retrieves the meta data with the given id.
     * @param metaDataId
     * @return the requested meta data
     * @throws DataNotFoundException when the specified meta data could not be found
     */
    public MetaData getMetaData(long metaDataId);
    
    /**
     * Retrieves the meta data with the given id.
     * @return all meta data
     * @throws DataNotFoundException when the specified meta data could not be found
     */
    public Iterable<MetaData> getAllMetaData();
    
    /**
     * Deletes the meta data with the given ID.
     * @param metaDataId
     * @throws DataNotFoundException when the specified meta data could not be found
     */
    public void delete(long metaDataId);
}
